package com.autoswf.core
{
	import flexunit.framework.TestCase;
	
	public class LinkUtilTest extends TestCase
	{
		private var link1:Link = new Link("link1");
		
		
		/** A specific link is returned */		
		public function test01():void
		{
			assertStrictlyEquals(link1, LinkUtil.getLink("link1", link1));
		}
		
		/** A link is not returned if there is no id match */
		public function test02():void
		{
			assertNull(link1, LinkUtil.getLink("link0", link1));
		}
		
		/** A sub level link is returned. */
		public function test03():void
		{
			var link2:Link = new Link("link2");
			
			LinkUtil.join(link2, link1);
			
			assertStrictlyEquals(link1, LinkUtil.getLink("link1", link2));
		}
		
		/** A sub level link is not returned if there is no id match. */
		public function test04():void
		{
			var link2:Link = new Link("link2");
			
			LinkUtil.join(link2, link1);
			
			assertNull(LinkUtil.getLink("link2->link0", link2));
		}
	}
}